export function format (id,before_formated_data){
  let child_id = before_formated_data[Object.keys(before_formated_data).filter(key => key.match(id))]
  return {
    id,
    children:child_id.map(id => {
      return {id,children:format(id, before_formated_data)}
    })
  }
 }
 
 export function getDepth(depth,data){
   let {children} = data
   if(children){
     children.forEach(child =>{
       if(child.children){
         depth = getDepth(++depth,child.children)
       }
     })
   }
   return depth
 }
 
